﻿/**
 * Jean-François Desgagné 2009 Portfolio
 * Copyright (c) 2009 Jean-François Desgagné <jfesgagne@gmail.com>
 * 
 * This work is licensed under a Creative Commons Attribution 3.0 United States License.
 * Some Rights Reserved.
 */
package com.jfdesgagne.jfdesgagne09.modules.showcase {
    import org.puremvc.as3.multicore.interfaces.IFacade;
    import org.puremvc.as3.multicore.patterns.facade.Facade;
	import com.jfdesgagne.jfdesgagne09.modules.showcase.controller.*;
   
    
    public class ApplicationFacade extends Facade implements IFacade{
        // Notification name constants
        public static const STARTUP:String  			= "startup";
        public static const INITIALIZE:String  			= "initialize";
		public static const NAME:String  				= "showcaseFacade";
		public static const OPEN_SLIDESHOW:String  		= "openSlideshow";
		public static const LOADSLIDESHOWIMAGES:String  = "loadSlideShowImages";
		public static const IMAGESLOAD_COMPLETE:String  = "imagesLoadComplete";
		public static const IMAGELOAD_PROGRESS:String  	= "imageLoadProgress";
		
		
		public function ApplicationFacade(key:String) {
			super(key);	
		}
		
		public static function getInstance(key:String):ApplicationFacade {
 			if (instanceMap[key] == null) instanceMap[key]  = new ApplicationFacade(key);
 			return ApplicationFacade(instanceMap[key]);
        }
		
		public function get shellFacadeInstance():ApplicationFacade {
 			return ApplicationFacade(com.jfdesgagne.jfdesgagne09.shell.ApplicationFacade.NAME);
        }
		
		

        override protected function initializeController() : void {
            super.initializeController(); 
			this.registerCommand(STARTUP, StartupCommand);
			this.registerCommand(LOADSLIDESHOWIMAGES, LoadSlideshowImageCommand);
			this.registerCommand(OPEN_SLIDESHOW, OpenSlideshowCommand);
        }
		
        public function startup($site:Object):void {
        	this.sendNotification(STARTUP, $site);
        }

        
    }
}